<?php

namespace App\Models;

/**
 * App\Models\UserMessageCommentSend
 * This is the model class for table "user_message_comment_send_".
 *
 * @property int $id 自增ID
 * @property string $message_id 消息ID
 * @property string $sender_id 评论/回复动作发起者ID
 * @property string $receive_id 评论/回复动作接收者ID
 * @property string $comment_id 评论/回复ID
 * @property string $reply_id 回复ID
 * @property string $target_id 评论/回复主体对象ID
 * @property int $target_type 评论/回复主体对象类型：1文章，2笔记，3评论，4回复，5收藏夹
 * @property int $type 消息类型，1评论，2回复
 * @property int $is_deleted 是否删除，0正常，1删除
 * @property int $is_read 是否已读，0未读，1已读
 * @property int $is_static 是否完成静态化，0否1是
 * @property int $created_at 创建时间戳
 * @property int $updated_at 最后修改时间戳
 * @property SysNote $note
 * @property SysDynamic $dynamic
 * @property SysComment $comment
 * @property SysReply $reply
 * @method static \Illuminate\Database\Eloquent\Builder|UserMessageCommentSend newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|UserMessageCommentSend newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|UserMessageCommentSend query()
 */
class UserMessageCommentSend extends BaseModel
{

    protected $table = "user_message_comment_send_";
    protected $primaryKey = "sender_id";
    protected $keyType = "string";
    public $timestamps = true;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'created_at' => 'timestamp',
        'updated_at' => 'timestamp',
    ];
    
    /**
     * 模型属性 - comment
     * @return SysComment|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
     */
    public function getCommentAttribute()
    {
        return SysComment::getModel($this->target_id)->where(['comment_id' => $this->comment_id])->first();
    }

    /**
     * 模型属性 - reply
     * @return SysComment|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
     */
    public function getReplyAttribute()
    {
        return SysReply::getModel($this->comment_id)->where(['reply_id' => $this->reply_id])->first();
    }

    /**
     * 模型属性 - note
     * @return SysComment|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
     */
    public function getNoteAttribute()
    {
        return SysNote::getModel($this->target_id)->where(['note_id' => $this->target_id])->first();
    }

    /**
     * 模型属性 - dynamic
     * @return SysComment|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
     */
    public function getDynamicAttribute()
    {
        return SysDynamic::getModel($this->receive_id)->where(['dynamic_id' => $this->target_id])->first();
    }

}
